<%--
  Created by IntelliJ IDEA.
  User: wh110
  Date: 2021/11/22
  Time: 17:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
//   判断是否保存cookie
    Cookie[] cookies = request.getCookies();
    for (Cookie c : cookies) {
        if (c.getName().equals("username")){
            pageContext.setAttribute("username",c.getValue());
        }
        if (c.getName().equals("password")){
            pageContext.setAttribute("password",c.getValue());
        }
    }

%>

    <form action="login1" method="get">
        <table align="center" cellspacing="30px">
            <tr>
                <td>账号:</td>
                <td><input type="text" name="name" value="${username}"></td>
            </tr>
            <tr>
                <td>密码:</td>
                <td><input type="password" name="pwd" value="${password}"></td>
            </tr>
            <tr>
                <td colspan="2"><input type="checkbox" value="checkOn" name="save" <c:if test="${!empty username }">checked</c:if>>记住账号和密码</td>
            </tr>
            <tr>
                <td colspan="2"><input type="submit" value="提交"></td>
            </tr>
        </table>

    </form>
</body>
</html>
